<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<?php echo $this->Html->charset(); ?>
	<title>
		<?php echo 'Simple Family Photos - '. $title_for_layout; ?>
	</title>
	<?php
		echo $this->Html->meta('icon');
		echo $this->Html->css('cake.generic', 'stylesheet');
		echo $this->Html->css('blueprint/screen', 'stylesheet');
		echo $this->Html->css('blueprint/print', 'stylesheet', array('media' => 'print'));
		echo $this->Html->css('jquery-ui-1.8.10.custom', 'stylesheet');
		echo $this->Html->css('default', 'stylesheet');
	?>
	<!--[if lt IE 8]><link rel="stylesheet" href="css/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]-->
	<!--
	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
	-->
	<?php
		echo $this->Html->script('jquery.min'); // Include jQuery library
		//$this->Js->JqueryEngine->jQueryObject = '$j';
		
		//Tell jQuery to go into noconflict mode
		echo $this->Html->scriptBlock('var $j = jQuery.noConflict();');

		echo $this->Html->script('jquery-ui-1.8.10.custom.min');
		echo $this->Html->script('sfp');
	?>

	<?php
		echo $scripts_for_layout;
	?>
</head>
<body>
	<div id="container">
		<div id="header" class="container">
			<div id="logo" class="centertext">
				<?php echo $html->link($html->image('/img/sfp_albums_100h200w.png'), '/',
										array('escape' => false)); ?>
			</div>
			<div id="search">
				<!--<h1>-->
				<div id="searchInner" class="centertext">
				<?php echo $html->image('/img/text_logo.png', array('alt'=> 'Simple Family Photos', 'url' => '/')); ?>
				<!-- ?php echo $html->link('Simple Family Photos', '/'); ? -->
				</div>
				<!--</h1>-->
				<?php
				if ($this->Session->check('Auth.Person.id')) {
				    if ($this->name == 'Events' && $this->action == 'index') {
				        echo $this->Form->create('Event', array('url' => array_merge($this->params['named'], array('controller' => 'events', 'action' => 'index'))));
				    } else {
					    echo $this->Form->create('Event', array('url' => array('controller' => 'events', 'action' => 'index')));
					}
					echo $this->Form->input('query', array('label' => '', 'value' => 'Search for events'));
																		//'value' => ($hasFilter ? $this->params['named']['query'] : 'Search for events')
					echo $this->Form->end();
				}
				?>
			</div>
			<div id="controls"><?php	
				if ($this->Session->check('Auth.Person.id'))  { 
					if (isset($currentUser_first_name) || isset($currentUser_last_name)) {
						$name = $currentUser_first_name . ' ' . $currentUser_last_name;
					}
					else { // username must be set
						$name = $currentUser_username;
					} ?>
					<div><strong>Welcome, <?php echo $name; ?></strong></div>
					<div><?php 
						echo $html->link('Your account', '/people/manage');
						echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
						echo $html->link('Logout', array('controller' => 'People', 'action' => 'logout')); ?>
					</div>
					<div><?php
						echo $html->link('Help', array('controller' => 'people', 'action' => 'help'));
						echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
						if ($isAdmin)
							echo $html->link('Admin help', '/people/adminhelp');
						else
							echo '<br />'; ?>
					</div><?php
					echo $html->link('Create new family', '/families/create');
				}  ?>
			</div>
		</div>
		
		<div id="container-header">
			<!-- happens above the main container -->
		</div>
		
		<div id="content" class="container">
			<?php  
			if($this->Session->check('Message.flash')) { 
				echo $this->Session->flash();
			} 
			?>
			
			<?php echo $content_for_layout; ?>
			
		</div>
		<div id="footer">
			<!-- happens below the main container -->
		</div>
	</div>
	<?php //echo $this->element('sql_dump');  // disable this on live releases ?>
	
	<?php //echo $this->Js->writeBuffer(); // Write cached scripts ?>
</body>
</html>
